package com.zxy.model;

import com.zxy.enums.PoMasterStatus;
import com.zxy.enums.VendorStatus;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data

public class PoMaster extends BaseModel{
    private String id;
    private Integer vendorId;
    private String vendorName;
    private LocalDate poDate;
    private BigDecimal totalPrice;
    private String brief;
    private Integer status;
    private String purchaser;
    private String statusX;
//    前端在调用的时候，传输明细
    private List<PoItem> items;
    public String getStatusX() {
//        先拿 VendorStatus 里面的一个静态方法 findByCode
//        如果不为空，直接返回getMsg,为空，则返回空
        PoMasterStatus poMasterStatus = PoMasterStatus.findByCode(this.getStatus());
        if(poMasterStatus != null){
            return poMasterStatus.getMsg();
        }
        return "";
//这时候我们的接口就会多一个statusX

//        return statusX;
    }


}
